import './App.css';
import { Routes, Route, unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';
import Login from '@/pages/Login';
import GeekLayout from '@/pages/Layout';
import AuthComponent from './components/AuthComponent';
import Home from '@/pages/Home';
import Article from '@/pages/Article';
import Publish from '@/pages/Publish';
import { history } from './utils';

function App() {
  return (
    <HistoryRouter history={history}>
      <div className="App">
        <Routes>
          {/* 需要鉴权 */}
          <Route path="/" element={
            <AuthComponent>
              <GeekLayout />
            </AuthComponent>
          }>
            <Route index element={<Home />} />
            <Route path="article" element={<Article />} />
            <Route path="publish" element={<Publish />} />
          </Route>
          <Route path="/login" element={<Login />}></Route>
        </Routes>
      </div>
    </HistoryRouter>
  );
}

export default App;
